package com.example.star.mapper;

import com.example.star.entity.Post;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PostMapper {
    @Select("SELECT * FROM posts")
    List<Post> getAllPosts();
    @Insert("INSERT INTO posts (username,imageResource,title, content,create_time) VALUES ( #{userName},#{imageResource},#{title}, #{content},NOW())")
    void addPost(Post post);
}
